#include "formnew.h"
#include "ui_formnew.h"
#include"admin.h"
#include<QSqlQuery>
#include<QSqlRecord>
#include<QDebug>
#include"execsql.h"

Formnew::Formnew(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Formnew)
{
    ui->setupUi(this);
}

Formnew::~Formnew()
{
    delete ui;
}

void Formnew::showaw()
{
    Admin *aw = new Admin;
    aw->show();
    aw->selectBoxSlot(str);
}

void Formnew::showformnew()
{
    emit signalformnew();
    this->show();
}

//void Formnew::on_tab1_face_clicked()
//{
//    pronew.startDetached("D:\\openmv\\bin\\openmvide.exe",QStringList());
//    if(pronew.isOpen() == false)
//    {
//        pronew.close();
//    }
//}

//void Formnew::on_tab_face_clicked()
//{
//    pronew.startDetached("D:\\openmv\\bin\\openmvide.exe",QStringList());
//    if(pronew.isOpen() == false)
//    {
//        pronew.close();
//    }
//}

//void Formnew::on_tab2_face_clicked()
//{
//    pronew.startDetached("D:\\openmv\\bin\\openmvide.exe",QStringList());
//    if(pronew.isOpen() == false)
//    {
//        pronew.close();
//    }
//}

void Formnew::on_tab2_cancle_clicked()
{
    this->hide();
    this->showaw();
}

void Formnew::on_tab_cancle_clicked()
{
    this->hide();
    this->showaw();
}

void Formnew::on_tab1_ok_clicked()
{
    ExecSQL esql;
    ainfonew=esql.insertAdminInfo(ui->tab1_id->text(),ui->tab1_name->text(),ui->tab1_sex->text(),
                                                                   ui->tab1_birth->text(),ui->tab1_pswd->text());
}
void Formnew::on_tab_ok_clicked()
{
    ExecSQL esql;
    tinfonew= esql.insertTeacherInfo(ui->tab_id->text(),ui->tab_teacherid->text(),ui->tab_xid->text(),ui->tab_name->text(),
                         ui->tab_sex->text(),ui->tab_birth->text(),ui->tab_pswd->text());
}

void Formnew::on_tab2_ok_clicked()
{
     ExecSQL esql;
    sinfonew= esql.insertStudentInfo(ui->tab2_id->text(),ui->tab2_xuehao->text(),ui->tab2_name->text(),
                               ui->tab2_loginpw->text(),ui->tab2_sex->text(),ui->tab2_classid->text(),ui->tab2_retime->text());
}

void Formnew::on_tab1_cancle_clicked()
{
    this->hide();
    this->showaw();
}
